Public Class frmCALCULATOR
    Dim IsStart As Boolean = True
    Dim Number1 As Double
    Dim Number2 As Double
    Dim Oper As String
    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtResult.Text = ""
    End Sub
    Private Sub ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UiButton9.Click, UiButton8.Click, UiButton7.Click, UiButton6.Click, UiButton5.Click, UiButton4.Click, UiButton39.Click, UiButton3.Click, UiButton2.Click, UiButton10.Click, UiButton1.Click, UiButton11.Click
        If IsStart Then
            txtResult.Text = ""
        End If
        txtResult.Focus()
        SendKeys.Send(CType(sender, Janus.Windows.EditControls.UIButton).Text)
        IsStart = False
    End Sub
    Private Sub OperatorClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UiButton15.Click, UiButton14.Click, UiButton13.Click, UiButton12.Click
        Number1 = CDbl(txtResult.Text)
        Oper = CType(sender, Janus.Windows.EditControls.UIButton).Text
        IsStart = True
    End Sub

    Private Sub UiButton16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UiButton16.Click
        Number2 = CDbl(txtResult.Text)
        Select Case Oper
            Case "*"
                txtResult.Text = String.Format(PublicVariable.NumberFormatString, CDbl(Number1) * CDbl(Number2))
            Case "/"
                txtResult.Text = String.Format(PublicVariable.NumberFormatString, CDbl(Number1) / CDbl(Number2))
            Case "+"
                txtResult.Text = String.Format(PublicVariable.NumberFormatString, CDbl(Number1) + CDbl(Number2))
            Case "-"
                txtResult.Text = String.Format(PublicVariable.NumberFormatString, CDbl(Number1) - CDbl(Number2))
        End Select
        IsStart = True
    End Sub

    Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
        PublicVariable.frmCalculator.Hide()
    End Sub

    Private Sub UiButton17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UiButton17.Click
        txtResult.Text = String.Format(PublicVariable.NumberFormatString, CDbl(txtResult.Text) / 100)
    End Sub

    Private Sub UiButton18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UiButton18.Click
        txtResult.Text = String.Format(PublicVariable.NumberFormatString, 1 / CDbl(txtResult.Text))
    End Sub
End Class
